package com.sdyc.ndmp.cls.model;


import com.sdyc.ndmp.cls.engine.Match;
import java.io.Serializable;
import java.util.Set;

public class SonW implements Serializable {

    public final static int VECTOR_PRO=-1;

    public final static int VECTOR_ALL=0;

    public final static int VECTOR_AFT=1;

    private int vector=0;

    private int len=-1;

    private int contains=0;

    private Set<String> words;

    /**
     搜索范围: CONTENT/TITLE/FULLTEXT/SOURCE
     */
    private String field;

    public int getVector() {
        return vector;
    }

    public void setVector(int vector) {
        this.vector = vector;
    }

    public int getLen() {
        return len;
    }

    public void setLen(int len) {
        this.len = len;
    }

    public int getContains() {
        return contains;
    }

    public void setContains(int contains) {
        this.contains = contains;
    }

    public Set<String> getWords() {
        return words;
    }

    public void setWords(Set<String> words) {
        this.words = words;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    @Override
    public String toString() {
        StringBuilder sb=new StringBuilder();
        switch (vector){
            case SonW.VECTOR_ALL:
                sb.append("全部");break;
            case SonW.VECTOR_PRO:
                sb.append("向前");break;
            case SonW.VECTOR_AFT:
                sb.append("向后");break;
        }

        if(len<0){
            sb.append("任意字距内");
        }else{
            sb.append(len+"字距内");
        }

        switch (Match.valueOf(contains)){
            case MATCH_ALL:
                sb.append("全部包含");break;
            case MATCH_ANY:
                sb.append("任意包含");break;
            case MATCH_NOT:
                sb.append("不包含");break;
        }
        sb.append(words);

        return sb.toString();
    }
}
